from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter
## 使用 mixin

router = DefaultRouter(trailing_slash=False) ## trailing_slash=False 关闭尾部斜杠
'''
router.register(
    prefix,           # URL 前缀
    viewset,          # 你的 ViewSet 类
    basename='...'    # URL 名称的前缀（可选，但建议写）
)
'''
router.register(r'', views.StaffViewSet, basename='staff')

app_name = 'staff'
# urlpatterns = [
#     path('departments', views.DepartmentListView.as_view(), name='departments'),
#     path('active', views.ActiveStaffView.as_view(), name='activeview'),
#     path('test', views.TestCeleryview.as_view(), name='testcelery'),
# ] + router.urls   ##把 router 的 URL 挂载进来urlpatterns

urlpatterns = [
    # 先挂载 router 的路由
    path('', include(router.urls)),
    # 再加额外的
    path('departments/', views.DepartmentListView.as_view(), name='departments'),
    path('active/', views.ActiveStaffView.as_view(), name='activeview'),
    path('test/', views.TestCeleryview.as_view(), name='testcelery'),
    path('download/', views.StaffDownloadView.as_view(), name='download_staff'),
    path('upload/', views.StaffUploadView.as_view(), name='upload_staff'),
]